<?php if (!defined('THINK_PATH')) exit(); /*a:1:{s:76:"/webHome/host6366235/www/public/../application/teacher/view/login/login.html";i:1679839690;}*/ ?>

<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <title>登录</title>
    <meta content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0" name="viewport"/>
    <meta content="yes" name="apple-mobile-web-app-capable"/>
    <meta content="black" name="apple-mobile-web-app-status-bar-style"/>
    <meta content="telephone=no" name="format-detection"/>
    <link rel="shortcut icon" href="/public/static/admin/uploads/set/<?php echo $setting['ico']; ?>">
    <link href="/public/static/home/themes/css/login.css" rel="stylesheet">
    <style>
        #content{
            display: none;
            padding: 30px;
            box-sizing: border-box;
        }
        #content div{
            width:90%;
            height:36px;
            margin:0 auto 15px;
        }
        #content div input{
            box-sizing: border-box;
            padding-left:15px;
            border:0px;
            border:1px solid #666;
            outline-color: #03b24d;
            border-radius: 3px;
        }
        #content div:nth-of-type(2) input{
            width:100%;
            height: 36px;
        }
        #content div:nth-of-type(3) input{
            width:50%;
            height: 36px;
        }
        #content div:nth-of-type(3) button{
            width: 45%;
            float: right;
            height: 36px;
            border: 0px;
            background:#03b24d;
            border:1px solid #03b24d;
            border-radius: 3px;
            color:#fff;
        }
        #check_code{
            width: 100%;
            height: 36px;
            border:0px;
            margin-top:0px;
            font-size:14px;
        }
    </style>
</head>

<body>

<div class="login-logo circle text-center" style="background-image:url(/public/static/admin/uploads/set/<?php echo $setting['logo']; ?>)"></div>

    <form name="forms" onSubmit="return checkreg()" action="homepage.html" method="post" class="login-cont" id="form1">
        <div style="color:#999;font-size:16px;text-align:center;">
            <?php echo $setting['school_name']; ?>-教师
        </div>
        <ul>
            <li><input type="text" name="tel" id="tel" placeholder="请输入您的手机号" value=""></li>
            <li>
                <span id="box"><input type="password"  name="password" placeholder="请输入密码" id="password" value=""/></span>
                <span id="click"><a href="javascript:ps()" class="iconfont icon-biyan"></a></span>
            </li>
        </ul>
        <a href="javascript:;"  class="button text-center block" id="login">登 录</a>
    </form>


<script src="/public/static/admin/layui/layui.js"></script>
<script type="text/javascript">
    layui.use('upload', function() { //独立版的layer无需执行这一句
        var $ = layui.jquery, layer = layui.layer,upload = layui.upload; //独立版的layer无需执行这一句

        //登录
        $("#login").click(function () {
            //判断手机号码是否有误
           let phone = $("#tel").val();
            if( phone == ""){
                layer.msg("请输入您的手机号",{time:2000,shade:0.5});
                return false;
            }
            if(!(/^1[3456789]\d{9}$/.test(phone))){
                layer.msg("请输入正确的手机号",{time:2000,shade:0.5});
                return false;
            }
            //判断密码是否为空
            if($("#password").val() == ""){
                $("#password").focus();
                layer.msg("请输入密码", {time: 2000,shade:0.5});
                return false;
            }
            //实现登录
            var from = $("#form1").serializeArray();
            var data = {}
            from.forEach((el)=>{
                data[el.name] = el.value;
            })
            $.post("<?php echo url('Login/tologin'); ?>",data,function(data){
               layer.msg(data.msg,{time:2000,shade:0.5},function(){
                   if(data.url){
                       window.location.href = data.url;
                   }
               });
           });


        });
        //回车登录
        document.onkeydown = function (event) {
            var e = event || window.event;
            if (e && e.keyCode == 13) { //回车键的键值为13
                $("#login").click(); //调用登录按钮的登录事件
            }
        };

    });


    function ps(){
        if (this.forms.password.type="password")
            box.innerHTML="<input type=\"text\" name=\"password\" size=\"20\" id='password' placeholder='请输入密码' value="+this.forms.password.value+">";
        click.innerHTML="<a href=\"javascript:txt()\" class=\"iconfont icon-open-eye\"></a>"
    }
    function txt(){
        if (this.forms.password.type="text")
            box.innerHTML="<input type=\"password\" name=\"password\" size=\"20\" id='password' placeholder='请输入密码' value="+this.forms.password.value+">";
        click.innerHTML="<a href=\"javascript:ps()\" class=\"iconfont icon-biyan\"></a>"
    }

</script>

</body>
</html>
